package bscorp.appbase.bmo;

import android.util.Log;

import java.sql.SQLException;
import java.util.List;

import bscorp.appbase.AppManager;
import bscorp.appbase.db.M4Dao;
import bscorp.appbase.model.Operate;

public class OperateBmo {

    /**
     * 保存设备信息
     *
     * @param model
     */
    public boolean saveOperate(Operate model) {
        try {
            M4Dao.getInstance(AppManager.context).add(model, Operate.class);
            return true;
        } catch (SQLException e) {
            Log.e("jamie", "---saveDevice error---");
            return false;
        }
    }

    /**
     * 读取设备信息
     *
     * @return
     */
    public List<Operate> getOperateByOrderId(int orderId) {
        List<Operate> list = null;
        try {
            list = M4Dao.getInstance(AppManager.context).getByValue("orderId", orderId, Operate.class);
            return list;
        } catch (SQLException e) {
            Log.e("jamie", "---getDevices error---" + e.getMessage());
        }
        return null;
    }
}
